function register() {
    let username = document.getElementById('username').value
    let password = document.getElementById('password').value
    if(!username || !password) {
        alert('用户名和密码不能为空！');
        return
    }
    if(localStorage.getItem(username)) {
        alert('用户名已注册');
    }
     else {
        localStorage.setItem(username,password)
        alert('注册成功');
        document.getElementById('registerForm').reset()
        window.location = "./登录.html"
    }
}